﻿using System.Text;
using MathMLToCSharp.Builders;

namespace MathMLToCSharp.Entities
{
  /// <summary>
  /// Radical. These do not exist in C#, so cubic root of N is encoded as <c>Math.Pow(N, 1/3)</c>.
  /// </summary>
  internal class Mroot : WithBinaryContent
  {
    public Mroot(IBuildable first, IBuildable second) : base(first, second) { }

    public override void Visit(CodeBuilder cb, BuildContext bc)
    {
      cb.Append("Math.Pow(");
      first.Visit(cb, bc);
      cb.Append(", 1 / ");
      second.Visit(cb, bc);
      cb.Append(")");
    }
  }
}